/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo.grafico;

import java.awt.Color;
import java.awt.Font;
import modelo.Punto;
import modelo.SegmentoLinea;
import no.geosoft.cc.graphics.GObject;
import no.geosoft.cc.graphics.GPosition;
import no.geosoft.cc.graphics.GSegment;
import no.geosoft.cc.graphics.GStyle;
import no.geosoft.cc.graphics.GText;

/**
 *
 * @author Fredy
 */
public class SegmentoLineaGrafico extends GObject {

    private GSegment linea;
    private SegmentoLinea miSegmentoLinea;
    private GStyle      textStyle_;

    public SegmentoLineaGrafico(Punto pPuntoO, Punto pPuntoF) {
        miSegmentoLinea = new SegmentoLinea(pPuntoO, pPuntoF);
        linea = new GSegment();
        GStyle estilo = new GStyle();
        estilo.setForegroundColor(new Color(252, 213, 180));//219, 229, 241
        estilo.setBackgroundColor(new Color(252, 213, 180));
        estilo.setLineWidth(3);
        setStyle(estilo);
        addSegment(linea);
        setName("");
    }

    public void draw() {

        linea.setGeometry(
                getMiSegmentoLinea().getOrigen().getCoordenadaX()
                , getMiSegmentoLinea().getOrigen().getCoordenadaY()
                , getMiSegmentoLinea().getFin().getCoordenadaX()
                , getMiSegmentoLinea().getFin().getCoordenadaY()
                );
    }

    /**
     * @return the miSegmentoLinea
     */
    public SegmentoLinea getMiSegmentoLinea() {
        return miSegmentoLinea;
    }

    /**
     * @param miSegmentoLinea the miSegmentoLinea to set
     */
    public void setMiSegmentoLinea(SegmentoLinea miSegmentoLinea) {
        this.miSegmentoLinea = miSegmentoLinea;
    }



    public void fijarTexto(String pTexto, Color pColor){
      textStyle_ = new GStyle();
      textStyle_.setForegroundColor (pColor);
      textStyle_.setFont (new Font ("Dialog", Font.BOLD, 14));

      GText text = new GText (pTexto);
      text.setPositionHint(GPosition.SOUTHWEST);
      text.setStyle (textStyle_);
      linea.setText(text);

    }
   
}
